<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<!DOCTYPE html>
<html lang="en" class="body-full-height">
<head>
    <base href="/admin/statics/ui/">
    <!-- META SECTION -->
    <title>国投物业后台管理系统</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta name="viewport" content="width=device-width, initial-scale=1"/>

    <link rel="stylesheet" type="text/css" id="theme" href="/statics/admin/ui/css/theme-default.css"/>
    <script type="text/javascript" src="/statics/admin/ui/js/plugins/jquery/jquery.min.js"></script>
    <script type="text/javascript" src="/statics/admin/base.js"></script>
    <script>
        cookie("token", null);
        cookie("sysUserToken", null);
        cookie("id", null);
        cookie("JSESSIONID", null);
    </script>
</head>
<body>

<div class="login-container">
	<div class="login-box animated fadeInDown">
	<div class="login-logo"></div>
		<div class="login-body">
			<div class="login-title"><strong>欢迎</strong>, 请登录</div>
			<div id="passwordPop" class="login-title"></div>
			<div class="form-horizontal">
				<div class="form-group">
					<div class="col-md-12">
						<input type="text" class="form-control" name="username" placeholder="用户名"/>
					</div>
				</div>
				<div class="form-group">
					<div class="col-md-12">
						<input id="password" type="password" class="form-control" name="password" placeholder="密码"/>
					</div>
				</div>
				<div class="form-group">
					<div class="col-md-6">
						<button id="loginButtonDo" class="btn btn-info btn-block">登录</button>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>

<script>
function loginAction(){
	$("#passwordPop").html("");
	var p = $("#password").val();
	if (!p) {
		alert("请输入密码");
		return;
	}
	$.ajax("/admin/loginAction.jspx",
	{
		'type':'post',
		'data':{'password': p},
		'dataType':'json',
		'success':function(data, textStatus, jqXHR){
			console.log(data);
			if (data.code == 0) {
				window.location.href = "/admin/index.jspa";
				return;
			}
			if (data.code == 1400) {
				$("#passwordPop").html(data.description);
				return;
			}
		}
	});
}
$("#loginButtonDo").on("click", loginAction);

$("body").on("keydown",function (e) {
	if (e.keyCode == 13) {
		loginAction();
	}
});
</script>
</body>
</html>






